from os.path import join, dirname
from time import sleep
from PyQt5.QtCore import QUrl
from PyQt5.QtMultimedia import QMediaPlayer, QMediaContent
from PyQt5.QtWidgets import QApplication

app = QApplication([])
media_player = QMediaPlayer()
file_path = join(dirname(__file__), "res", "test.mp3")
url = QUrl.fromLocalFile(file_path)
media_player.setMedia(QMediaContent(url))
media_player.play()
sleep(5)
# media_player.pause()
media_player.stop()
app.exec_()
